//
// Created by xili on 2024/9/23 19:57.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

//枚举左维护右
class Solution {
public:
    int numPairsDivisibleBy60(vector<int> &time) {
        int n = time.size();
        int ans = 0;
        vector<int> cnt(60);
        for (int i = 0; i < n; i++) {
            ans += cnt[(60 - time[i] % 60) % 60];
            cnt[time[i] % 60]++;
        }
        return ans;
    }
};